<?php
/*
Overmundo, cultura de todo o Brasil
Desenvolvido pela Tecnopop para o Núcleo de Idéias Movimento
Copyright (C) 2006  Núcleo de Idéias Movimento

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

*/


header("Expires: ".gmdate("D, d M Y H:i:s")."GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: text/css; charset=iso-8859-1"); 

$nivelPagina = "cadastrado";
$secaoAtual = "perfil";

include('../lib/checa_login.php');

class_exists('Site') || require('../lib/class.site.php');
class_exists('Overmundo') || require('../lib/class.overmundo.php');
class_exists('Conecta') || require('../lib/class.conecta.php');
class_exists('Usuario') || require('../lib/class.usuario.php');
class_exists('Favorito') || require('../lib/class.favorito.php');



	$minhaConexao = new Conecta();
	$meuSite = new Overmundo();
	$meuSite->linkid = $minhaConexao->linkid;



if (($meuSite->LimpaCampo($_GET["apelido"])) || ($meuSite->LimpaCampo($_SESSION["apelido"]))) {
	if ($meuSite->LimpaCampo($_GET["apelido"])){
		$apelido = $meuSite->LimpaCampo($_GET["apelido"]);
	} else {
		$apelido = $meuSite->LimpaCampo($_SESSION["apelido"]);
	}
	
	$resUsuario = $meuSite->OvermundoListaUsuarios(" tituloUnicoUsuario = '$apelido'", "");
	if ($row = mysql_fetch_array($resUsuario)) {
		$usuarioEscolhido = new Usuario($meuSite->linkid, $row["codUsuario"]);
		if($usuarioEscolhido->PegaStatus() != "ativo"){
			exit("usuario inativo.");
		}
	}
	
	$_SESSION["apelido"] = $apelido;
}


if (isset($_GET["opcao"])) {
	
	$opcao = $_GET["opcao"];
	
	switch ($opcao) {
		case "admira":
			
			//favorito
			$usuarioLogado->AdmiraUsuario($usuarioEscolhido->PegaCodUsuario(), "admira");
			
			break;
			
		case "remove":
			//favorito
			$usuarioLogado->AdmiraUsuario($usuarioEscolhido->PegaCodUsuario(), "remove");
			
			break;
	}
	
}

?>
